#include "config.h"

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include "CLI.h"
#include "Problem.h"
#include "Method.h"
#include "mvfcpp.h"
#include "problem1.h"


int CLI::runCLIInterface()
{
    int problemNumber=1;
    int methodNumber=1;

//default values
    unsigned int populationSize=100;
    unsigned int iterations=100;

#if COMMAND_PROMPT==1
    std::cout<<"Population Size: \n";
    std::cin>>populationSize;
    std::cout<<"Number of Iterations: \n";
    std::cin>>iterations;
#endif

    problem1 *problem=new problem1();
    Method::SubType methodType=(Method::SubType) (methodNumber-1);
    Method *method=Method::createMethod(methodType, problem, populationSize, iterations);

//Run once for each test function
//std::vector<double> smallestKnown;
int i, k;
    for(i=0; i<problem->getNumberOfProblems(); i++)
    {
        std::cout<<"___"<<i<<"_______________________________________________________________________\n";
        OptimizedValue optStruct=method->optimize(i);
//        smallestKnown.push_back(optStruct.value);
        std::cout<<"\noptimized value is : "<<optStruct.value<<" \t ";
        std::cout<<"at point: [";
        for(k=0; k<problem->getDimention(); k++)
            std::cout<<optStruct.atPoint[k]<<",  ";
        std::cout<<"]\n\n";
    }


    delete problem;
    problem=0;
    delete method;
    method=0;
    return EXIT_SUCCESS;
//    return;
}


